{include file="../app/common/admin/lib/header.html" title="添加多图文"}
<div class="page-header border-bottom clearfix">
  <h2 class="left">添加多图文<span>在这里添加多图文信息，左侧是预览图</span></h2>
  <a href="{:url('/appmsg/admin/index')}" class="btn btn-default btn-sm right">&lt;&nbsp;返回多图文列表</a>
</div>
<div class="addbox">
  <div class="addinfo clearfix">
    <!--{*<span class="ntc2">在这里添加多图文信息，左侧是预览图</span>*}-->
    <div class="left">
      <div class="showmulti">
        <ul class="multi-list js_leftList">
          <li class="currEdit" {if $appmsg_info}data-id="{$appmsg_info.id}"{/if}>
            <em class="multi-link-alt js_relationIcon" {if $appmsg_info.relation_id==0}style="display:none;"{/if}></em>
            <div class="big">
              <span class="date">{if $appmsg_info.add_time}{:time_format($appmsg_info.add_time, 'Y-m-d')}{else /}{:date('Y-m-d')}{/if}</span>
              <div class="withmap">
                <div class="withmap-img-box js_leftCover">
                {if $appmsg_info.cover}<img src="{:_image($appmsg_info.cover, 'small')}" alt="">{/if}
                </div>
                <h3 class="tit2 js_leftTitle">{if $appmsg_info.title}{$appmsg_info.title}{else}标题{/if}</h3>
              </div>
              <div class="multi-mask" style="display:none;">
                <!--{*<a href="javascript:void(0);" class="btn btn-default btn-xxs js_previewBtn">预览图文</a>-->
                <!--<a href="javascript:void(0);" class="btn btn-info btn-xxs js_relationBtn">关联单图文</a>*}-->
                <a href="javascript:void(0);" class="btn btn-success btn-xxs js_setBtn">设置</a>
              </div>
            </div>
          </li>
          {foreach $son_list as $k1=>$v1}
          <li data-id="{$v1.id}">
            <em class="multi-link-alt js_relationIcon" {if $v1.relation_id==0}style="display:none;"{/if}></em>
            <div class="small clearfix">
              <h3 class="tit3 left js_leftTitle">{$v1.title}</h3>
              <div class="withmap2 right js_leftCover">{if $v1.cover}<img src="{:_image($v1.cover, 'small_equal')}" alt="">{/if}</div>
            </div>
            <div class="multi-mask multi-mask2" style="display:none;">
              <!--{*<a href="javascript:void(0);" class="btn btn-default btn-xxs js_previewBtn">预览图文</a>-->
              <!--<a href="javascript:void(0);" class="btn btn-info btn-xxs js_relationBtn">关联单图文</a>*}-->
              <a href="javascript:void(0);" class="btn btn-success btn-xxs js_setBtn">设置</a>
              <a href="javascript:void(0);" class="btn btn-danger btn-xxs  js_delBtn">删除</a>
            </div>
          </li>
          {/foreach}
          {if !$appmsg_info}
          <li>
            <em class="multi-link-alt js_relationIcon" style="display:none;"></em>
            <div class="small clearfix">
              <h3 class="tit3 left js_leftTitle">标题</h3>
              <div class="withmap2 right js_leftCover"></div>
            </div>
            <div class="multi-mask multi-mask2" style="display:none;">
              <!--{*<a href="javascript:void(0);" class="btn btn-default btn-xxs js_previewBtn">预览图文</a>-->
              <!--<a href="javascript:void(0);" class="btn btn-info btn-xxs js_relationBtn">关联单图文</a>*}-->
              <a href="javascript:void(0);" class="btn btn-success btn-xxs js_setBtn">设置</a>
              <a href="javascript:void(0);" class="btn btn-danger btn-xxs js_delBtn">删除</a>
            </div>
          </li>
          {/if}
        </ul>
        <p class="btn-wrap4">
          <a href="javascript:void(0);" class="btn btn-success btn-sm js_addMoreBtn">新增一条</a>
        </p>
      </div>
    </div>
    <div class="fillbox js_rightBox">
      <span class="arrowbg js_pointerBg"></span>
      <i class="arrowmayer js_pointer"></i>
      <div class="innerfill">
        <div class="fillbox-link-alt js_relationMask" {if $appmsg_info.relation_id==0}style="display:none;"{/if}>
          <a href="javascript:void(0);" class="fillbox-link-concel js_cancelRelation">取消关联</a>
          <span class="fillbox-link-img"></span>
        </div>
        <div class="fillbar">
          <input type="text" value="{if $appmsg_info.title}{$appmsg_info.title}{else}标题 （必填）{/if}" class="txt1 js_title">
        </div>
        <!--{*<div class="fillbar">-->
          <!--<input type="text" value="作者 （选填）" class="txt1">-->
        <!--</div>*}-->
        <div class="fillbar" id="js_upFileBox">
          <form id="file-form" method="post" action="{$Think.const.SITE_URL}/appmsg/save/upload_file" enctype="multipart/form-data" target="upload_target">
            <a href="javascript:void(0);" class="btn-file-mayer"><i></i>上传封面</a>
            <input type="file" name="upload_cover" class="btn-file js_uploadFile" {if $appmsg_info.relation_id gt 0}style="left:-1000px;"{/if}>
            <input type="hidden" name="type" class="js_imageType" value="1" />
            <span class="ntc3">大图片建议尺寸：<br/>360像素*200像素</span>
          </form>
          <input id="hide-cover" name="cover" type="hidden" value="" />
        </div>
        <div class="fillbar hidden" id="js_upLoading">上传中...</div>
        <div class="fillbar">
          <p class="txtradio">
            <label><input type="checkbox" value="1" name="show_cover" {if $appmsg_info.show_cover == 1}checked{/if}>&nbsp;是否在详情中显示封面</label>
          </p>
        </div>
        <div class="fillbar">
          <textarea class="txt2 js_intro">{if $appmsg_info.intro}{$appmsg_info.intro}{else}摘要 （选填）{/if}</textarea>
        </div>
        <div class="fillbar">
          <p class="txtradio">
            <label><input type="radio" value="2" name="content_type" class="js_contentType" {if !$appmsg_info || $appmsg_info.content_type == 2}checked{/if}>图文详情</label>
            <label><input type="radio" value="1" name="content_type" class="js_contentType" {if $appmsg_info.content_type == 1}checked{/if}>链接地址</label>
          </p>
          <input class="txt1 js_link {if $appmsg_info.content_type != 1}hidden{/if}" type="text" value="{if $appmsg_info.link}{$appmsg_info.link}{else}链接地址（选填）{/if}">
          <textarea id="js_editor" class="txteditor js_content {if $appmsg_info.content_type == 1}hidden{/if}">{if $appmsg_info.content}{$appmsg_info.content}{else /}{/if}</textarea>
        </div>
        <div class="fillbar js_sourceUrlBox" {if $appmsg_info.content_type == 1}hidden{/if}>
          <input type="text" value="{$appmsg_info.source_url}" class="txt1 js_sourceUrl">
        </div>
      </div>
    </div>
  </div>
</div>
<p class="btn-wrap2">
  <button type="button" class="btn btn-success js_saveBtn">确认</button>
  <button type="button" class="btn btn-info js_saveBtn js_noRedirect" style="margin-left:17px;">保存</button>
  <button type="button" data-id="{$appmsg_info.id}" class="btn btn-default js_previewBtn" style="margin-left:17px;">预览</button>
</p>
{if $appmsg_info}
  <div id="js_appmsgContent" style="display:none;">{:htmlspecialchars_decode($appmsg_info.content)}</div>
{/if}
{if $son_list}
  {foreach $son_list as $k=>$v}
    <div id="js_{$k}content" style="display:none;">{:htmlspecialchars_decode($v.content)}</div>
  {/foreach}
{/if}

{js href='./static/js/ueditor1_4_3_3/ueditor.config.js'}
{js href='./static/js/ueditor1_4_3_3/ueditor.all.js'}
{js href="./static/js/module/appmsg.js"}
<script>
var appmsgId = "{$appmsg_info.id}";
var fillTitle = "标题 （必填）";
var fillIntro = "摘要 （选填）";
var fillLink  = "链接地址（必填）";
var fillSourceUrl  = "原文链接（选填）";

var editor;

var postData = [];
{if $appmsg_info}
  postData[0] = { 'id':"{$appmsg_info.id}", 'title':{:json_encode($appmsg_info.title)}, 'intro':{:json_encode($appmsg_info.intro)}, 'cover':"{$appmsg_info.cover}", 'content_type':"{$appmsg_info.content_type}", 'link':"{$appmsg_info.link}", 'content':$('#js_appmsgContent').html(), 'relation_id':"{$appmsg_info.relation_id}", 'show_cover':"{$appmsg_info.show_cover}", 'source_url':"{$appmsg_info.source_url}" };
{/if}

{if $son_list}
{foreach $son_list as $k=>$v}
  postData[parseInt("{$k}")+1] = { 'id':"{$v.id}", 'title':{:json_encode($v.title)}, 'intro':{:json_encode($v.intro)}, 'cover':"{$v.cover}", 'content_type':"{$v.content_type}", 'link':"{$v.link}", 'content':$("#js_{$k}content").html(), 'relation_id':"{$v.relation_id}", 'show_cover':"{$v.show_cover}", 'source_url':"{$v.source_url}" };
{/foreach}
{/if}

$(function(){
  // 遮罩不可点击
  $(".js_relationMask").click(function(e){
    e.stopPropagation();
    e.preventDefault();
  });
  
  // 初始化编辑器
  editor = new UE.ui.Editor();
  editor.render("js_editor");

  inputPlaceHold($(".js_title"), fillTitle, "{$appmsg_info.title}");
  inputPlaceHold($(".js_intro"), fillIntro, "{$appmsg_info.intro}");
  inputPlaceHold($(".js_link"), fillLink, "{$appmsg_info.link}");
  inputPlaceHold($(".js_sourceUrl"), fillSourceUrl, "{$appmsg_info.source_url}");
  
  syncInput($(".js_title"), $(".js_leftTitle").eq(0), fillTitle, '标题');
  
  // 是输入链接还是输入图文
  $(".js_contentType").click(function(){
    var currValue = $(this).val();
    //showMsg(currValue);
    if (currValue == 1) {
      $(".js_link").show().removeClass('hidden');
      //$(".js_content").addClass('hidden');
      $(".js_sourceUrlBox").addClass('hidden');
      editor.setHide();
    } else {
      $(".js_link").hide();
      
      $(".js_content").removeClass('hidden');
      $(".js_sourceUrlBox").removeClass('hidden');
      editor.setShow();
    }
  });
  
  // 上传封面
  $(".js_uploadFile").live('change', function(){
   var fileName = $(this).val();
   if (!fileName) {
     return false;
   }
   
   if (!isAllowFile(fileName)) {
     showMsg("请上传常规格式的图片,如：jpg, png等");
     return false;
   }
    
   $("#file-form").submit();
   
   $("#js_upLoading").show();
   $("#js_upFileBox").hide();
  });
  
  // 左侧Item hover出现
  $(".js_leftList li").live('mouseover', function(e){
    $(this).find('.multi-mask').show();
  });
  // 左侧Item hover消失
  $(".js_leftList li").live('mouseout', function(e){
    $(this).find('.multi-mask').hide();
  });
  
  // 添加一个
  $(".js_addMoreBtn").click(function(){
    if ($(".js_leftList li").length >= 8) {
      showMsg('最多只能有8条信息');
      return false;
    }
    
    var html = '<li>\
                 <em class="multi-link-alt js_relationIcon" style="display:none;"></em>\
                  <div class="small clearfix">\
                    <h3 class="tit3 left js_leftTitle">标题</h3>\
                    <div class="withmap2 right js_leftCover"></div>\
                  </div>\
                  <div class="multi-mask multi-mask2" style="display:none;">\
                    <a href="javascript:void(0);" class="btn btn-default btn-xxs js_previewBtn" style="display:none;">预览图文</a>\
                    <a href="javascript:void(0);" class="btn btn-info btn-xxs js_relationBtn" style="display:none;">关联单图文</a>\
                    <a href="javascript:void(0);" class="btn btn-success btn-xxs js_setBtn">设置</a>\
                    <a href="javascript:void(0);" class="btn btn-danger btn-xxs js_delBtn">删除</a>\
                  </div>\
                </li>';
    
    $(".js_leftList").append(html);
  });
  
  // 删除一个
  $(".js_delBtn").live('click', function(){
    var thisObj = $(this).closest('li');
    
    if ($(".js_leftList li").length <=2) {
      showMsg('多图文信息至少要两条记录');
      return false;
    }
    
    var currIndex = thisObj.index();
    if (typeof postData[currIndex] != 'undefined') {
      postData.splice(currIndex, 1);
    }
    thisObj.remove();
  });
  
  // 切换左侧item
  $(".js_leftList li .js_setBtn").live('click', function(e){
    var thisObj = $(this).closest('li');
    
    if (thisObj.index() == 0) {
      $("#js_upFileBox .ntc3").html('大图片建议尺寸：<br>360像素*200像素');
      $(".js_imageType").val(1);
    } else {
      $("#js_upFileBox .ntc3").html('小图片建议尺寸：<br>200像素*200像素');
      $(".js_imageType").val(2);
    }
    // 添加元素
    addMsgItem();
    
    // 选中新元素，填充右边区域
    fillMsgItem(thisObj);
  });
  
  // 关联一条单图文
  $(".js_relationBtn").live('click', function(){
    var thisObj = $(this).closest('li');
    
    //showLoading();hideLoading();
    var html  = '<div class="float-prompt-con"><p class="float-pic-info">请选择关链到已有的图文信息，或者去&nbsp;<a target="_blank" href="'+siteUrl+'/appmsg/add/1.html">添加新的图文信息</a></p>';
        html += '<div class="js_msgList"><img src="'+siteUrl+'/images/loading2.gif"></div></div>';
    ace.dialog({
      'title':'选择图文信息',
      'content':html,
      'init':function(){
        $(".aceDialog").width(960);
        $(".aceContent").height(400);
        $(".aceContent").css('overflow', 'auto');
        
        setTimeout(function(){
          resetDialogPosition($(".aceDialog"));
        }, 10);
        $(".js_msgList").load(siteUrl+'/appmsg/admin/get_msg_list', { 'type':1 }, function(){
          bindMsgEvent(thisObj);
        });
        
        $(".js_msgList .page>a").live('click', function(e){
          e.preventDefault();
          var _href = $(this).attr('href');
          $(".js_msgList").load(_href, { 'type':1 }, function(){
            bindMsgEvent(thisObj);
          });
        });
      },
      'okValue':''
    });
    
    // 选中新元素，填充右边区域
    //fillMsgItem(thisObj);
  });
  
  // 取消关联
  $(".js_cancelRelation").click(function(e){
    e.preventDefault();
    
    showConfirm('您确定要取消图文关联吗?', 1, function(){
      var currObj = $(".currEdit");
      var currIndex = $(".currEdit").index();
      
      $(".js_relationMask").hide();
      $(".js_uploadFile").css('left', '0px');
      currObj.find(".js_relationIcon").hide();
      postData[currIndex].relation_id = 0;
      //postData[currIndex].id = ;
      postData[currIndex].cancel_relation = 1;
    });
  });
  
  var isPost = 0;
  // 保存图文信息
  $(".js_saveBtn").click(function(){
    var thisObj = $(this);
    
    //consoleLog(postData);return false;
    if (isPost == 1) {
      showMsg('信息提交中，请稍候...');
      return false;
    }
    
    // 添加之前，把当前展示的信息也进入数组中
    addMsgItem();
    
    if (postData.length < 2) {
      showMsg('多图文信息最少需要2条信息');
      return false;
    }
    
    //console.log(postData);
    var postData1 = {};
    var postErr = 0;
    $.each(postData, function(i, n){
      //consoleLog(n);
      if (typeof n == 'undefined') {
        showMsg('不能存在空的图文信息');
        postErr = 1;
        return false;
      }
      
      if (!n.title || !$.trim(n.title) || $.trim(n.title) == fillTitle || getFontNum($.trim(n.title)) > 64) {
        showMsg('列表'+(i+1)+'的标题不能为空且长度不能超过64字');
        postErr = 1;
        return false;
      }
      if (n.intro == fillIntro) {
        postData[i].intro = '';
      }
      
      if (!n.cover && ( typeof n.id =="undefined" || n.id < 1)) {
        showMsg('请上传列表'+(i+1)+'的配图');
        postErr = 1;
        return false;
      }
      
      if (n.content_type == 1) {
        if (!n.link || !$.trim(n.link) || $.trim(n.link) == fillLink) {
          showMsg('列表'+(i+1)+'图文链接不能为空');
          postErr = 1;
          return false;
        }
        if (!checkStr(n.link, 'link')) {
          showMsg('列表'+(i+1)+'存在为空的链接');
          postErr = 1;
          return false;
        }
      } else if (n.content_type == 2) {
        if (!n.content || getFontNum(n.content) > 40000) {
          showMsg('列表'+(i+1)+'图文详情不能为空且长度不能超过40000字');
          postErr = 1;
          return false;
        }
        
        n.link = '';
      }
      
      //postData[i]['view_order'] = i;
      //postData1['data'+i] = n;
    });
    //consoleLog(postData);return;
    if (postErr > 0) {
      return false;
    }
    
    isPost = 1;
    $.post(siteUrl+'/appmsg/save/2', { 'data':postData }, function(json){
      if (json.info != 'ok') {
        isPost = 0;
        showMsg(json.info);
        return false;
      }
      
      $.each(json.ids, function(i, n){
        $(".js_leftList li").eq(i).attr('data-id', n);
      });
      
      isPost = 0;
      showMsg('保存成功', 1);
      //alert(thisObj.hasClass('js_noRedirect'));
      // 确认后需跳转，仅保存时不跳转
      if (!thisObj.hasClass('js_noRedirect')) {
        if (storeId >= 1) {
          window.location.href = siteUrl+'/appmsg/admin?verify='+json.verify;
        } else {
          window.location.href = siteUrl+'/appmsg/admin';
        }
      } else {
        //alert(1);
        window.location.href = siteUrl+'/appmsg/add/2?id='+json.id+'&to_bottom=1';
      }
    }, 'json').error(function(e){
      isPost = 0;
      showMsg('网络不稳定，请稍后再试');
    });
  });
  
  setTimeout(function(){
    addMsgItem();
  }, 3000);
});

{if $to_bottom == 1}
setTimeout(function(){
  $('html,body').animate({ scrollTop:$('.js_saveBtn').offset().top }, 10);
}, 800);

{/if}

// 添加一个元素
function addMsgItem()
{
  var currEditItem  = $(".js_leftList li.currEdit");
  var currEditIndex = currEditItem.index();
  var currEidtId    = currEditItem.attr('data-id');
  
  if (typeof postData[currEditIndex] != 'undefined' && typeof postData[currEditIndex].relation_id != 'undefined' 
      && postData[currEditIndex].relation_id > 0) {
    consoleLog(postData[currEditIndex].relation_id);
    return false;
  }
  consoleLog(postData, 'qian_add');
  
  var title = $(".js_title").val();
  var intro = $(".js_intro").val();
  var cover = $("#hide-cover").val();
  
  // 图文回复类型
  var contentType = $(".js_contentType:checked").val();
  var link  = $(".js_link").val();
  var content = editor.getContent();
  
  var showCover = $(':input[name="show_cover"]:checked').length;
  var sourceUrl = $('.js_sourceUrl').val();
  if (sourceUrl == fillSourceUrl) {
    sourceUrl = '';
  }
  
  //alert(currEditIndex);
  var cancelRelation = 0;
  if (typeof postData[currEditIndex] != 'undefined' && typeof postData[currEditIndex].cancel_relation != 'undefined') {
    cancelRelation = postData[currEditIndex].cancel_relation;
    if (!cover && typeof postData[currEditIndex].cover) {
      cover = postData[currEditIndex].cover;
    }
  }

  postData[currEditIndex] = { 'id':currEidtId, 'title':title, 'intro':intro, 'content_type':contentType, 'link':link, 'content':content, 'cancel_relation':cancelRelation, 'show_cover':showCover, 'source_url':sourceUrl };

  if (postData[currEditIndex].cover && !cover) {
  } else {
    postData[currEditIndex].cover = cover;
  }
  //console.log(postData);
}

// 切换左侧item时，填充右侧表单值
function fillMsgItem(obj, relationInfo)
{
  obj.siblings().removeClass('currEdit');
  obj.addClass('currEdit');
  
  var selectIndex = obj.index();
  if (relationInfo) {
    var id = 0;
    if (typeof postData[selectIndex] != 'undefined' && typeof postData[selectIndex].id != 'undefined') {
      var id = postData[selectIndex].id;
    }
    postData[selectIndex] = { 
        'id':id,
        'title':relationInfo.title, 
        'intro':relationInfo.intro,
        'cover':relationInfo.cover, 
        'content_type':relationInfo.content_type,
        'link':relationInfo.link, 
        'content':relationInfo.content,
        'relation_id':relationInfo.id,
        'real_cover':relationInfo.real_cover,
        'show_cover':relationInfo.show_cover,
        'source_url':relationInfo.source_url
    };
    
    obj.find(".js_relationIcon").show();
    //consoleLog(postData);
    obj.find(".js_leftCover").html('<img src="'+siteUrl+relationInfo.real_cover+'">');
    obj.find(".js_leftTitle").html(relationInfo.title);
  }
  if (typeof postData[selectIndex] == "undefined") {
    postData[selectIndex] = { 'title':fillTitle, 'intro':fillIntro, 'cover':'', 'content_type':2, 'link':fillLink, 'content':'', 'relation_id':0, 'source_url':'' };
  }
  
  if (postData[selectIndex].relation_id > 0) {
    $(".js_uploadFile").css('left', '-1000px');
    $(".js_relationMask").show();
  } else {
    $(".js_uploadFile").css('left', '0px');
    $(".js_relationMask").hide();
  }
  
  $(".js_title").val(postData[selectIndex].title);
  $(".js_intro").val(postData[selectIndex].intro);
  $("#hide-cover").val(postData[selectIndex].cover);
  
  if (postData[selectIndex].showCover == 1) {
    $(':input[name="show_cover"][value="1"]').attr('checked', 'checked');
  } else {
    $(':input[name="show_cover"][value="1"]').removeAttr('checked');
  }
  
  if (postData[selectIndex].content_type == 1) {
    $(".js_contentType[value='1']").attr('checked', 'checked');
    
    $(".js_sourceUrlBox").addClass('hidden');
    editor.setHide();
    $(".js_link").show();
  } else {
    $(".js_contentType[value='2']").attr('checked', 'checked');
    
    $(".js_content").removeClass('hidden');
    $(".js_sourceUrlBox").removeClass('hidden');
    editor.setShow();
    $(".js_link").hide();
  }
  $(".js_link").val(postData[selectIndex].link);
  $(".js_sourceUrl").val(postData[selectIndex].source_url);
  editor.setContent(postData[selectIndex].content);
  
  consoleLog('q', selectIndex, postData[selectIndex])
  // 更改要同步的对象
  inputPlaceHold($(".js_title"), fillTitle, postData[selectIndex].title);
  inputPlaceHold($(".js_link"), fillLink, postData[selectIndex].link);
  inputPlaceHold($(".js_sourceUrl"), fillSourceUrl, postData[selectIndex].source_url);
  
  syncInput($(".js_title"), $(".js_leftTitle").eq(selectIndex), fillTitle, '这里是标题');
  
  // 更改箭头指向
  var _offset = obj.offset();
  var _offset2 = $(".js_pointer").offset();
  //console.log(_offset.top, _offset.left, _offset2.top, _offset2.left);
  if (selectIndex == 0) {
    $(".js_pointer").css('top', '100px');
    $(".js_pointerBg").css('top', '100px');
    $(".js_rightBox").css('margin-top', '0px');
  } else {
    //var _top = 227+obj.height()*(selectIndex-1);
    var _top = 45+obj.height()*selectIndex;
    //$(".js_pointer").css('top', _top+'px');
    //$(".js_pointerBg").css('top', _top+'px');
    $(".js_rightBox").css('margin-top', _top+'px');
  }
}

// 上传后的更新
function upfileFinish(coverPath, cover, errMsg)
{
  if (!errMsg) {
    $("li.currEdit .js_leftCover").html('<img src="'+coverPath+'" />');
    $("#hide-cover").val(cover);
  } else {
    showMsg();
  }
  
  $("#js_upLoading").hide();
  $(".js_uploadFile").after('<input type="file" name="upload_cover" class="btn-file js_uploadFile">');
  $(".js_uploadFile").eq(0).remove();
  $("#js_upFileBox").show();
  
  addMsgItem();
}

// 图文列表加载后的事情绑定
function bindMsgEvent(thisObj)
{
  $(".js_msgList>li").unbind('click');
  // 选择某一条图文做为回复
  $(".js_msgList>li").bind('click', function(e){
    e.preventDefault();
    var _selectObj = $(this);
    if (!_selectObj.hasClass('curr')) {
      var id = _selectObj.attr('data-id');
      if (!id) {
        showMsg('请选择一条信息');
        return false;
      }
      
      showConfirm('您确定要选择该图文信息吗?', 1, function(){
        // 添加元素
        addMsgItem();
        qDialog.close();
        
        // 选中新元素，填充右边区域
        showLoading();
        $.post(siteUrl+'/appmsg/admin/get_msg_info', { 'id':id }, function(json){
          hideLoading();
          if (json.info != 'ok') {
            showMsg(json.info);
            return false;
          }
          
          fillMsgItem(thisObj, json.msg_info);
        }, 'json');
      });
    }
  });
}
</script>
<div id="uploadIframebox">
  <iframe id="uploadIframe" name="upload_target" style="display:none;"></iframe>
</div>
{include file="../app/common/admin/lib/footer.html"}